<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>

<div id="messages">
	<form:errors path="customer.*" cssClass="errors" />
</div>

<form:form modelAttribute="customer" action="submitPersonal">

	<fieldset>
		<h4>Change Customer Information</h4>
		<br/>

		<div class="field">
			<div class="label">
				<label for="email">Email:</label>
			</div>
			<div class="input">
				<form:input path="email" maxlength="40"/>
				<script type="text/javascript">
					Spring.addDecoration(new Spring.ElementDecoration({
						elementId : "email",
						widgetType : "dijit.form.ValidationTextBox",
						widgetAttrs : { required : true, regExp: "([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})" }}));
				</script>
			</div>
		</div>

 
		<div class="field">
			<div class="label">
				<label for="password">Password:</label>
			</div>
			<div class="input">
				<form:password path="password" maxlength="40"/>
				<script type="text/javascript">
					Spring.addDecoration(new Spring.ElementDecoration({
						elementId : "password",
						widgetType : "dijit.form.ValidationTextBox",
						widgetAttrs : { required : true }}));
				</script>
			</div>
		</div>

		<div class="field">
			<div class="label">
				<label for="confirmPwd">Confirm Password:</label>
			</div>
			<div class="input">
				<form:password path="confirmPwd" maxlength="40"/>
				<script type="text/javascript">
					Spring.addDecoration(new Spring.ElementDecoration({
						elementId : "confirmPwd",
						widgetType : "dijit.form.ValidationTextBox",
						widgetAttrs : { required : true }}));
				</script>
			</div>
		</div>
		
		<div class="field">
			<div class="label">
				<label for="address1">Address:</label>
			</div>
			<div class="input">
				<form:input path="address1" maxlength="40"/>
				<script type="text/javascript">
					Spring.addDecoration(new Spring.ElementDecoration({
						elementId : "address1",
						widgetType : "dijit.form.ValidationTextBox",
						widgetAttrs : { required : true }}));
				</script>
			</div>
		</div>


		<div class="field">
			<div class="label">
				<label for="address2">(Address)</label>
			</div>
			<div class="input">
				<form:input path="address2" maxlength="40"/>
				<script type="text/javascript">
					Spring.addDecoration(new Spring.ElementDecoration({
						elementId : "address2",
						widgetType : "dijit.form.ValidationTextBox",
						widgetAttrs : { required : false }}));
				</script>
			</div>
		</div>


		<div class="field">
			<div class="label">
				<label for="city">City:</label>
			</div>
			<div class="input">
				<form:input path="city" maxlength="40"/>
				<script type="text/javascript">
					Spring.addDecoration(new Spring.ElementDecoration({
						elementId : "city",
						widgetType : "dijit.form.ValidationTextBox",
						widgetAttrs : { required : true }}));
				</script>
			</div>
		</div>

		<div class="field">
			<div class="label">
				<label for="state">State:</label>
			</div>
			<div class="input">
				<form:input path="state" maxlength="2"/>
				<script type="text/javascript">
					Spring.addDecoration(new Spring.ElementDecoration({
						elementId : "state",
						widgetType : "dijit.form.ValidationTextBox",
						widgetAttrs : { required : true, regExp: "([A-Z]{2})" }}));
				</script>
			</div>
		</div>


		<div class="field">
			<div class="label">
				<label for="zip">Zip:</label>
			</div>
			<div class="input">
				<form:input path="zip" maxlength="40"/>
				<script type="text/javascript">
					Spring.addDecoration(new Spring.ElementDecoration({
						elementId : "zip",
						widgetType : "dijit.form.ValidationTextBox",
						widgetAttrs : { required : true, regExp: "([0-9]{5})"}}));
				</script>
			</div>
		</div>

		<div class="field">
			<div class="label">
				<label for="phone">Phone:</label>
			</div>
			<div class="input">
				<form:input path="phone" maxlength="40"/>
				<script type="text/javascript">
					Spring.addDecoration(new Spring.ElementDecoration({
						elementId : "phone",
						widgetType : "dijit.form.ValidationTextBox",
						widgetAttrs : { promptMessage : "Wrong Format. Valid format is 555-555-5555", required : false, regExp: "([0-9]{3})+\-([0-9]{3})+\-([0-9]{4})" }}));
				</script>
			</div>
		</div>
		
		
		<div class="buttonGroup">
			<input type="submit" value="Submit" id="proceed" />&#160;
			<script type="text/javascript">
				Spring.addDecoration(new Spring.ValidateAllDecoration({elementId:'proceed', event:'onclick'}));
			</script>
			<input type="button" value="Cancel" onclick="document.location.href='<c:url value="/spring/myaccount/index" />'"/>			
		</div>
	</fieldset>
</form:form>